<template>
    <a-card :bordered="false">
        <div class="table-operator">
            <a-button shape="round" size="small" type="primary" icon="plus" @click="handleEdit({},'busForm','新增')">添加</a-button>
        </div>

        <LTable
        ref="busListTable"
        size="middle"
        rowKey="keyId"
        :formAttributes="formAttributes"
        :columns="columns"
        axiosUrl="/KhyBusController/page"
        :showPagination="true"
        :showQueryForm="true"
      >

        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record,'busForm',record.plateNo)">详情</a>
          <a-divider type="vertical" />
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete({keyId:record.keyId},'/KhyBusController/del','busListTable')">
                <a>删除</a>
            </a-popconfirm>
        </span>
        
    </LTable>
    <busForm ref="busForm" @close="refresh('busListTable')" @ok="refresh('busListTable')"></busForm> 
    </a-card>
</template>

<script>
import LTable from '@/components/lt/LTable'
import request from '@/utils/request'
import busForm from './busForm'
import {SysMixin} from '@/mixins/SysMixin'
import defaultSettings from '@/config/defaultSettings'
export default {
    name:'busList',
    components:{LTable,busForm},
    mixins:[SysMixin],
    data(){
        return{
            initDictCodes:defaultSettings.数据字典.组织下拉树,
            defaultSettings,
            formAttributes:[
                
                {field:'plateNo',label:'车牌号',component:'input',condition:'like'},
                {field:'orgNo',label:'所属公司',component:'treeSelect',condition:'eq',dictCode:defaultSettings.数据字典.组织下拉树,},
            ],
         
            columns:[
                {
                    title: '序号',
                    dataIndex: '',
                    key:'rowIndex',
                    width:60,
                    align:"center",
                    customRender:function (t,r,index) {
                      return parseInt(index)+1;
                    }
                },
                 {
                    title: '组织',
                    dataIndex: 'orgNo',
                    customRender:(text)=>{
                        if(!text){
                            return ''
                        }else{
                            return this.dictText(defaultSettings.数据字典.组织下拉树,text)
                        }
                    }
                },
                
                {
                    title: '车牌号',
                    dataIndex: 'plateNo'
                },
                
                {
                    title: '操作',
                    dataIndex: 'action',
                    width: '120px',
                    scopedSlots: { customRender: 'action' }
                }
            ],
            
        }
    },
    created(){
       
    },
    methods:{
       
    }
}
</script>